#include <iostream>
#include <vector>
#include <string>

using namespace std;

string convertToBase7(int num) {
    string x, s = num >= 0 ? "" : "-"; num = abs(num);
    while(num >= 7){
        x += to_string(num%7);
        num /= 7;
    }
    x = x + to_string(num) + s;
    reverse(x.begin(),x.end());
    return x;
}

int main(){
    int num = -7;
    cout << convertToBase7(num) << endl;
    return 0;
}
